import { getUserInfo } from '../../api/user'
export default {
  state: {
    userInfo: []
  },
  mutations: {
    setUserInfo (state, userInfo) {
      state.userInfo = userInfo
    }

  },
  actions: {
    async AgetUserInfo (context) {
      const res = await getUserInfo()
      console.log(res, 888)
      context.commit('setUserInfo', res.data.data)
    }
  },
  getters: {
    avatarImg (state) {
      return state.userInfo.username ? state.userInfo.username.chatAt(0).toUpperCase() : ''
    }
  },
  namespaced: true
}
